{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 课程开发平台购买清单\n",
    "\n",
    "本课程使用树莓派4B平台进行教学演示，必选包价格仅需402.4元，还不到一顿大餐费用。\n",
    "\n",
    "(1)树莓派4B开发板（必选包），价格275元\n",
    "\n",
    "树莓派4B开发板，2G内存版本。购买2G的主板就可以。\n",
    "\n",
    "购买链接:https://item.taobao.com/item.htm?spm=a1z10.1-c.w4004-11687503770.2.75bf4f95kxR7UG&id=599466520653\n",
    "\n",
    "\n",
    "(2)TF卡（必选包），价格为19.9元\n",
    "\n",
    "banq 32GB TF，建议32G以上容量，32G的TF卡。\n",
    "\n",
    "购买链接:https://item.jd.com/100005934062.html#crumb-wrap\n",
    "\n",
    "\n",
    "(3)TF读卡器（必选包），价格5.9元\n",
    "\n",
    "绿巨能的USB迷你读卡器。\n",
    "\n",
    "购买链接:https://item.jd.com/100002592938.html#product-detail\n",
    "\n",
    "\n",
    "(4)树莓派4B散热外壳+树莓派摄像头（必选包），价格38.8元\n",
    "\n",
    "树莓派4B发热量还是挺大的，光靠扇热片已经不足以完成散热，室温20度时，树莓派4B的温度就能到60度。\n",
    "\n",
    "所以需要购买一个风扇，室温20度，树莓派4B运行咱们课程实验室，能保持温度在45度以下。\n",
    "\n",
    "下面的购买链接包含：树莓派4B外壳，树莓派4B风扇和500万像素的树莓派摄像头。\n",
    "\n",
    "购买链接:https://detail.tmall.com/item.htm?id=600652631816&spm=a1z09.2.0.0.59b22e8dRLUcVX&_u=32tfp3f811c&skuId=4510604210993\n",
    "\n",
    "\n",
    "(5)Type-C 电源（必选包），价格14.8元\n",
    "\n",
    "购买树莓派4B主板是不带电源的，我们需要购买一个电源。\n",
    "\n",
    "购买链接:https://detail.tmall.com/item.htm?spm=a230r.1.14.67.238a1cf5vOlAzs&id=605998321983&ns=1&abbucket=15\n",
    "\n",
    "\n",
    "(6)树莓派4B麦克风（必选包），价格:23元\n",
    "\n",
    "树莓派4B上是不在麦克风的，我们需要购买一个USB麦克风。\n",
    "\n",
    "购买链接:https://item.taobao.com/item.htm?spm=a1z09.2.0.0.59b22e8dRLUcVX&id=615610216448&_u=32tfp3f3e4c\n",
    "\n",
    "\n",
    "(7)树莓派显示器转接线（必选包），价格25元\n",
    "\n",
    "我们把树莓派当做计算机用，通过显示器转接线外接一个显示器，就能把树莓派当做一台计算机来使用。\n",
    "\n",
    "micro-hdmi转hdmi线，用于连接hdmi接口的显示器。\n",
    "\n",
    "购买链接：https://detail.tmall.com/item.htm?id=37607334919&spm=a1z09.2.0.0.7ef42e8doKc5NF&_u=32tfp3f16c1&sku_properties=122216547:3614136\n",
    "\n",
    "micro-hdmi转VGA线，用于连接VGA接口的显示器。价格59元。\n",
    "\n",
    "购买链接:https://detail.tmall.com/item.htm?id=14521697768&spm=a1z09.2.0.0.59b22e8dRLUcVX&_u=32tfp3fd13c&skuId=3312770956465\n",
    "\n",
    "(8)显示器(可选包)，价格489元\n",
    "\n",
    "当做树莓派4B的显示器，23寸hdmi接口创维显示器。\n",
    "\n",
    "购买链接:https://detail.tmall.com/item.htm?spm=a220o.1000855.0.da321h.52c31c98fcO3ES&id=607879139604&skuId=4508975559322\n",
    "\n",
    "(9)键盘鼠标(可选包)，价格29.9元\n",
    "\n",
    "当做树莓派4B的键盘鼠标，爱国者USB有线键盘鼠标套装。\n",
    "\n",
    "购买链接:https://detail.tmall.com/item.htm?id=566239738964&ali_refid=a3_430582_1006:1110635111:N:gYJXMBbnhmBR1M4V749JIbcSIV9ESWIT:a1ff607459ba4d01e1d30b4422691f3b&ali_trackid=1_a1ff607459ba4d01e1d30b4422691f3b&spm=a230r.1.14.1&skuId=3846666011830"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "######################################################\n",
    "#\n",
    "# 课程助理——智能小派来讲课,选择本cell，按shirt+enter键运行本模块\n",
    "#\n",
    "######################################################\n",
    "\n",
    "#!/usr/bin/env python\n",
    "# -*- coding: utf-8 -*-\n",
    "#\n",
    "# Copyright (c) 2020 Taste all Pi.\n",
    "#\n",
    "# Licensed under the GNU General Public License, Version 2.0 (the \"License\");\n",
    "# you may not use this file except in compliance with the License.\n",
    "# You may obtain a copy of the License at\n",
    "#\n",
    "#   http://www.gnu.org/licenses/gpl-2.0.html\n",
    "#\n",
    "# Unless required by applicable law or agreed to in writing, software\n",
    "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
    "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
    "# See the License for the specific language governing permissions and\n",
    "# limitations under the License.\n",
    "\n",
    "#导入标准库\n",
    "import sys\n",
    "import os\n",
    "\n",
    "#导入自定义库\n",
    "sys.path.append('../baidu_api_lib')\n",
    "from baidu_sound import baidu_word_2_sound\n",
    "\n",
    "\"\"\" 公开课的语音合成+人脸识别，可选更改为自己的api接口 \"\"\"\n",
    "APP_ID = '20558036'\n",
    "API_KEY = 'u3L19UyWw6Tmx8fvnkqufP4y'\n",
    "SECRET_KEY = '7VjAOyufSVY3IjlM6WV79xrhtivGwO8O'\n",
    "\n",
    "#阅读的内容\n",
    "rd_poem = [\"课程开发平台购买清单:\",\\\n",
    "            \"本课程使用树莓派4B平台进行教学演示，必选包价格仅需402.4元，还不到一顿大餐费用。\",\\\n",
    "            \"(1)树莓派4B开发板（必选包），价格275元\",\\\n",
    "            \"(2)TF卡（必选包），价格为19.9元\",\\\n",
    "            \"(3)TF读卡器（必选包），价格5.9元\",\\\n",
    "            \"(4)树莓派4B散热外壳+树莓派摄像头（必选包），价格38.8元\",\\\n",
    "            \"(5)Type-C 电源（必选包），价格14.8元\",\\\n",
    "            \"(6)树莓派4B麦克风（必选包），价格:23元\",\\\n",
    "            \"(7)树莓派显示器转接线（必选包），价格25元\",\\\n",
    "            \"(8)显示器(可选包)，价格489元\",\\\n",
    "            \"(9)键盘鼠标(可选包)，价格29.9元\"]\n",
    " \n",
    "if __name__ == \"__main__\":\n",
    "    try:\n",
    "        #传入百度AI的参数\n",
    "        word_2_sound = baidu_word_2_sound(APP_ID, API_KEY, SECRET_KEY)\n",
    "            \n",
    "        #以迭代方式阅读\n",
    "        for one_poem in rd_poem:\n",
    "            #进行语音合成\n",
    "            word_2_sound.trans_word_to_sound(one_poem,'tst_sound.wav')\n",
    "\n",
    "            #播放合成的语音\n",
    "            os.system('mplayer ' + 'tst_sound.wav')\n",
    "        \n",
    "        #删除临时文件    \n",
    "        os.remove('tst_sound.wav')\n",
    "        \n",
    "    except KeyboardInterrupt:\n",
    "        #删除临时文件    \n",
    "        os.remove('tst_sound.wav')\n",
    "        \n",
    "        print(\"任务被终止了\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
